# 関数コール回数予測 dict_models_perFunc_CG: dict[str, dict[str, str]] = [] for functionName in functionNames_CG: pass trainDF_perFunc: pd.DataFrame = trainDF_CG[ trainDF_CG["Name"] == functionName ].reset_index() str_ExtraPinputData_call: str = gen_ExtraPinputDataFromDF( inputDF=trainDF_perFunc, expVar=expVar_CG, resVar=resVar_CG, ) # モデル格納用の辞書 dictModels: dict[str, str] = {} # Extra-Pによるモデルの構築 converted_functionName: str = re.sub(r'[\\|/|:|?|.|"|<|>|\|\(|\)|]', "-", functionName) fileName: str = f"input_cg@{converted_functionName}" fileDir: str = f"./extra-p_docker/share/" filePath: str = fileDir + fileName with open(file=filePath, mode="w") as f: f.write(str_ExtraPinputData_call) for modelerName in modelerNames: str_resFromExtraP: str = subprocess.run( f"extrap --text {filePath} --modeler {modelerName} | grep Model", stdout=subprocess.PIPE, text=True, shell=True, ).stdout str_resFromExtraP = str_resFromExtraP.replace("Model: ", "") str_resFromExtraP = convert_log(str_resFromExtraP) print(str_resFromExtraP) model_fromExtraP = sympify(str_resFromExtraP, locals=dict_symbols_CG) dictModels[modelerName] # 提案手法によるモデルの構築 bestModelDict: dict = return_bestModelObject( inputDF=trainDF_perFunc, list_expVar=expVar_CG, list_resVar=[resVar_CG], list_modelName=list_modelName, ) dictModels["proposal"] = bestModelDict["object"] dict_models_perFunc_CG[functionName] = dictModels
# 表の作成 # |関数名|直接方式|分離方式| # <- 要素はMAPE _list_series :list[pd.Series] = [] for elem_process in train_lulesh_processes: for elem_iteration in train_lulesh_iterations: for elem_size in train_lulesh_sizes: target_env_oneCase = [ (dict_symbols_lulesh["size"], elem_size), (dict_symbols_lulesh["iteration"], elem_iteration), (dict_symbols_lulesh["process"], elem_process), ] for functionName in functionNames_lulesh:
# CGにおけるモデル構築 """ dict_cg_model_exclusive_all dict[str, sny]: Exclusive予測用のモデル@all to all dict_cg_model_exclusive_perCall dict[str, any]: Exclusive予測用のモデル@perCall dict_cg_model_call dict[str, any]: 関数コール予測用のモデル """ dict_cg_model_exclusive_all: dict[str, any] = {} dict_cg_model_exclusive_perCall: dict[str, any] = {} dict_cg_model_call: dict[str, any] = {} for functionName in functionNames_cg: trainDF_cg_perFunc: pd.DataFrame = trainDF_cg[trainDF_cg["Name"] == functionName] cg_model_exclusive_all: str = get_ExtraP_model( inputDF_perFunc=trainDF_cg_perFunc, expVar=expVar_cg, resVar=resVar_excl, functionName=functionName, dict_symbols=dict_symbols_cg, benchmarkName=benchmarkName_cg, modelerName=modelerName, modelerOption=modelerOption, ) cg_model_exclusive_perCall :str = get_ExtraP_model( inputDF_perFunc = trainDF_cg_perFunc, expVar = expVar_cg, resVar = resVar_perCall, functionName = functionName, dict_symbols = dict_symbols_cg, benchmarkName = benchmarkName_cg, modelerName = modelerName, modelerOption = modelerOption ) cg_model_call: str = get_ExtraP_model( inputDF_perFunc=trainDF_cg_perFunc, expVar=expVar_cg, resVar=resVar_call, functionName=functionName, dict_symbols=dict_symbols_cg, benchmarkName=benchmarkName_cg, modelerName=modelerName, modelerOption=modelerOption, )